#ifndef DATA_HOLDER_H_
#define DATA_HOLDER_H_

#include <string.h>
#include "led_data_type.h"
//#include "config.h"

// #define FLOOR_ACTION_SIZE 13
// #define WALL_ACTION_SIZE 20
// #define YAW_MAX_COUNT 100
// #define ON_FLOOR_PERIOD_LIST_SIZE 10
// #define DEPTH_LIST_SIZE 30
// #define THETA_HISTOGRAM_BIN_SIZE 50
// #define FAULT_RECORDS_SIZE 4
// #define DEBUG_DATA_SIZE 6
// #define DEBUG_RECORDS_SIZE 2

// enum Robot_pose_state
// {
//     ON_FLOOR = 0,
//     HEAD_UP_TILT,
//     HEAD_DOWN_TILT,
//     HEAD_UP_ON_WALL,
//     HEAD_DOWN_ON_WALL,
//     HEAD_UP_TURN_OVER,
//     HEAD_DOWN_TURN_OVER,
// };

// enum Robot_action
// {
//     MOVE_STRAIGHT_ON_FLOOR = 0,
//     MOVE_UP_ON_WALL,
//     MOVE_UP_ON_WALL_REDUCE_PUMP,
//     MOVE_UP_ON_WALL_WITHOUT_PUMP,
//     MOVE_UP_ON_WALL_WITH_PID,
//     MOVE_DOWN_ON_WALL,
//     MOVE_DOWN_ON_WALL_WITH_PID,
//     MOVE_DOWN_ON_WALL_WITH_MAX_SPEED,
//     TILT_WASH_ON_WALL,
//     FLOOR_ACTION_TURN_DIRECTION_BY_DURATION,
//     FLOOR_ACTION_TURN_TO_TARGET_ANGLE_WITH_TIMEOUT,
//     FLOOR_ACTION_ROTATION,
//     FLOOR_ACTION_TURN_BY_LEFT_WHEEL,
//     FLOOR_ACTION_TURN_BY_RIGHT_WHEEL,
//     FLOOR_ACTION_STOP,
//     FLOOR_ACTION_STOP_TO_CALIBRATE,
//     FLOOR_ACTION_FAST_LEFT_ROTATION,
//     FLOOR_ACTION_FAST_RIGHT_ROTATION,
//     FLOOR_ACTION_SLOW_LEFT_ROTATION,
//     FLOOR_ACTION_SLOW_RIGHT_ROTATION,
//     FLOOR_ACTION_REPEAT_OR_FINISH,
//     WALL_ACTION_TURN_DIRECTION_BY_DURATION,
//     WALL_ACTION_TURN_TO_TARGET_ANGLE_WITH_TIMEOUT,
//     WALL_ACTION_MOVE_UP_TO_WATERLINE,
//     WALL_ACTION_MOVE_BY_DURATION,
//     WALL_ACTION_MOVE_ON_WATERLINE,
//     WALL_ACTION_ROTATION,
//     WALL_ACTION_FAST_LEFT_ROTATION,
//     WALL_ACTION_FAST_RIGHT_ROTATION,
//     WALL_ACTION_SLOW_LEFT_ROTATION,
//     WALL_ACTION_SLOW_RIGHT_ROTATION,
//     WALL_ACTION_STOP,
//     WALL_ACTION_STOP_TO_GET_THETA,
//     WALL_ACTION_MOVE_DOWN_FROM_WATERLINE,
//     REVERSE_DIRECTION,
//     RECOVERY_FROM_TURN_OVER_STATE,
//     MOVE_SLOW_SPEED,
//     MOVE_MAX_SPEED_WITH_PUMP,
//     MOVE_MAX_SPEED_WITHOUT_PUMP,
//     STOP_MOVEMENT,
//     START_PUMP,
//     STOP_PUMP,
//     STOP_ALL,
//     LOW_BATTERY_STOP,
//     OUT_OF_WATER_STOP,
//     TIME_OVER_STOP,
//     WALKING_OVERLOAD_STOP,
//     PUMP_OVERLOAD_STOP,
//     AUTO_BACK_STOP,
//     LEFT_MOTOR_FORWARD,
//     RIGHT_MOTOR_FORWARD,
//     LEFT_MOTOR_BACKWARD,
//     RIGHT_MOTOR_BACKWARD,
//     MOVE_FORWARD_WITH_MAX_SPEED,
//     LEFT_TURN_ROTATION,
//     RIGHT_TURN_ROTATION,
//     REDUCE_PUMP,
//     FAST_LEFT_ROTATION_WITHOUT_PUMP,
//     FAST_RIGHT_ROTATION_WITHOUT_PUMP,
//     STOP_MOVEMENT_WITH_REDUCED_PUMP,
// };

// enum Robot_direction
// {
//     BACKWARD = -1,
//     FORWARD = 1,
//     LEFT = 2,
//     RIGHT = 3,
//     AUTO = 4,
// };

// enum Robot_wall_direction
// {
//     DOWNWARD = -1,
//     UPWARD = 1,
// };

// enum Robot_operation_mode
// {
//     MANUAL = 0,
//     STANDBY,
//     SELF_CHECK,
//     AUTO_WASHING,
//     AUTO_RETURN_BACK,
//     PRE_POWER_OFF,
//     POWER_OFF,
//     FAULT,
//     PRE_ENGINEERING_MODE,
//     ENGINEERING_MODE,
//     BLUETOOTH_MODE,
//     IOT_MODE,
//     DEBUG,
//     NO_MODE,
//     OTA_FORWARD_MODE,
// };


// enum Robot_cleaning_mode
// {
//     FLOOR_CLEANING_MODE,
//     WALL_CLEANING_MODE,
//     COMBINATION_CLEANING_MODE,
//     ALL_POOL_CLEANING_MODE,
//     WATERLINE_CLEANING_MODE,
//     POWERFUL_FLOOR_CLEANING_MODE,
//     AREA_CLEANING_MODE,
//     CLEANING_MODE_MAX,
// };

// enum Robot_route_mode
// {
//     // DEFAULT_ROUTE_MODE,             // 默认路径
//     // POOL_SHAPE_ADAPTIVE_ROUTE_MODE, // 泳池形状自适应路径
//     // 池底模式路径
//     FLOOR_STAR_ROUTE_MODE = 0,
//     FLOOR_S_ROUTE_MODE,
//     FLOOR_CROSS_ROUTE_MODE,
//     // 池壁模式路径
//     WALL_NORMAL_ROUTE_MODE = 10,
//     WALL_H_ROUTE_MODE,
//     WALL_N_ROUTE_MODE,
//     // 组合模式路径
//     TWICE_WALL_TWICE_FLOOR_ROUTE_MODE = 20,
//     ONCE_WALL_ONCE_FLOOR_ROUTE_MODE,
//     // 全池模式路径
//     ALL_POOL_STAR_ROUTE_MODE = 30,
//     ALL_POOL_CROSS_ROUTE_MODE,
//     // 水线模式路径
//     WATERLINE_ROUTE_MODE = 40,
//     CUSTOM_ROUTE_MODE = 60,
//     ROUTE_MODE_MAX,
// };

// enum Robot_floor_route_mode
// {
//     NO_FLOOR_ROUTE,
//     INITIAL_CROSS_ROUTE,
//     CENTER_CROSS_ROUTE,
//     FLOOR_SQUARE_ROUTE,
//     FLOOR_STAR_ROUTE,
//     FLOOR_S_INITIAL_ROUTE,
//     FLOOR_S_ROUTE,
//     FLOOR_CROSS_WASHING_ROUTE,
//     FLOOR_AUTO_RETURN_BACK_ROUTE,
//     FLOOR_AREA_WASHING_ROUTE,
// };

// enum Robot_wall_route_mode
// {
//     NO_WALL_ROUTE,
//     WALL_NORMAL_ROUTE,
//     WALL_H_ROUTE,
//     WALL_N_ROUTE,
//     WALL_WATERLINE_ROUTE,
//     WALL_WATERLINE_SIMPLE_ROUTE,
//     WALL_BACK_TO_WATERLINE_ROUTE,
// };

// enum Robot_engineering_mode
// {
//     IDLE = 0,
//     TOTAL_RUNNING_TIME = 1,
//     // IMU_CALIBRATION = 2,
//     PRODUCTION_TEST = 3,
//     SETTING_MODE_MAX
// };

// enum Engineering_action_state
// {
//     ENGINEERING_ACTION_STATE_NOT_SUPPORTED,
//     ENGINEERING_ACTION_STATE_IN_PROGRESS,
//     ENGINEERING_ACTION_STATE_SUCCESS,
//     ENGINEERING_ACTION_STATE_FAIL,
//     ENGINEERING_ACTION_STATE_IDLE,
// };

// // enum Robot_engineering_result
// // {
// //     FALSE = 0,
// //     TRUE = 1,
// //     IN_PROGRESS = 2,
// //     DONE = 3,
// // };

// enum Robot_motor_state
// {
//     NORMAL = 0,
//     OUT_OF_WATER,
//     SUCK_AIR,
//     UNDERLOAD,
//     OVERLOAD,
//     SHORT_CIRCUIT,
//     PUMP_SPOUT,
// };

// enum Self_test_action
// {
//     SELF_CHECK_START,
//     INITIAL_DELAY,
//     TEST_WALKING,
//     TEST_NO_MOTION,
//     TEST_PUMP,
//     OUT_OF_WATER_DELAY,
//     TEST_IMU
// };

// enum Pump_overload_action
// {
//     PUMP_OVERLOAD_START,
//     PUMP_OVERLOAD_DELAY,
//     // PUMP_OVERLOAD_TEST,
// };

// enum Walking_overload_action
// {
//     WALKING_OVERLOAD_START,
//     WALKING_OVERLOAD_ACTION_0,
//     WALKING_OVERLOAD_ACTION_1,
//     WALKING_OVERLOAD_ACTION_2,
// };

// enum Out_of_water_action
// {
//     OUT_OF_WATER_START,
//     OUT_OF_WATER_STOP_ALL,
//     OUT_OF_WATER_START_PUMP,
//     OUT_OF_WATER_TEST_PUMP,
//     OUT_OF_WATER_SPECIAL_ACTION_1,
//     OUT_OF_WATER_SPECIAL_ACTION_2,
//     OUT_OF_WATER_SPECIAL_ACTION_3,
//     OUT_OF_WATER_SPECIAL_ACTION_4,
//     OUT_OF_WATER_SPECIAL_ACTION_5,
//     OUT_OF_WATER_SPECIAL_ACTION_6,
// };

// enum Suck_air_action
// {
//     SUCK_AIR_START,
//     SUCK_AIR_STEP_1,
//     SUCK_AIR_STEP_2,
//     // SUCK_AIR_DOWN_WALL_ACTION,
// };

// enum Pump_spout_action
// {
//     PUMP_SPOUT_START,
//     PUMP_SPOUT_STOP_ALL,
//     PUMP_SPOUT_START_PUMP,
//     PUMP_SPOUT_FINISH,
// };

// enum Down_wall_stuck_action
// {
//     DOWN_WALL_STUCK_START,
//     DOWN_WALL_STUCK_MOVE_DOWN,
//     DOWN_WALL_STUCK_STOP_PUMP,
//     DOWN_WALL_STUCK_START_PUMP,
//     DOWN_WALL_STUCK_START_PUMP_UP_WALL,
//     DOWN_WALL_STUCK_STOP_PUMP_DOWN_WALL,
//     DOWN_WALL_STUCK_STOP,
// };

// enum Floor_stuck_action
// {
//     FLOOR_STUCK_START,
//     FLOOR_STUCK_STOP_PUMP_MOVE_ACTION,
//     FLOOR_STUCK_START_PUMP_MOVE_ACTION,
//     FLOOR_STUCK_START_PUMP_STOP_ACTION,
//     FLOOR_STUCK_FINAL_CHECK_START,
//     FLOOR_STUCK_FINAL_CHECK_ACTION,
//     FLOOR_STUCK_FINAL_STOP_ACTION,
// };

// enum Pool_shape
// {
//     POOL_SHAPE_RECTANGLE,
//     POOL_SHAPE_CIRCLE,
//     POOL_SHAPE_ELLIPSE,
//     POOL_SHAPE_OTHERS,
//     POOL_SHAPE_MAX
// };

// enum Pool_surface_material
// {
//     POOL_SURFACE_ROUGH,
//     POOL_SURFACE_REGULAR,
//     POOL_SURFACE_SMOOTH,
//     POOL_SURFACE_MAX,
// };

// enum Pool_floor_type
// {
//     POOL_FLOOR_TYPE_HORIZONTAL,
//     POOL_FLOOR_TYPE_SLOPING,
//     POOL_FLOOR_TYPE_DIAMOND,
//     POOL_FLOOR_TYPE_MAX
// };

// enum Reach_side_wall
// {
//     NOT_REACH_SIDE_WALL,
//     LEFT_SIDE_WALL,
//     RIGHT_SIDE_WALL,
// };

// enum Bluetooth_at_cmd
// {
//     RENAME,
//     GET_MAC_ADDRESS,
//     SET_CUSTOM_DATA,
// };

// enum Network_state
// {
//     BLUETOOTH_PROVISIONING,
//     SOFTAP_PROVISIONING,
//     WIFI_CONFIGURED,
//     ROUTER_CONNECTED,
//     SERVER_CONNECTED,
// };

// enum Bluetooth_state
// {
//     BLUETOOTH_BROADCASTING,
//     BLUETOOTH_CONNECTED,
//     BLUETOOTH_DISABLED,
// };

// enum Sensor_calibration_type
// {
//     SENSOR_CALIBRATION_IMU,
//     SENSOR_CALIBRATION_DEPTH,
// };

// enum Sensor_calibration_progress
// {
//     SENSOR_CALIBRATION_IN_PROGRESS,
//     SENSOR_CALIBRATION_FAIL,
//     SENSOR_CALIBRATION_SUCCESS,
// };

// enum Area_washing_coverage
// {
//     SMALL_COVERAGE_RANGE,
//     MEDIUM_COVERAGE_RANGE,
//     LARGE_COVERAGE_RANGE,
// };

// enum Area_washing_progress
// {
//     AREA_WASHING_IN_PROGRESS,
//     AREA_WASHING_FINISH,
// };

// enum Auto_back_type
// {
//     AUTO_BACK_TO_EDGE,
//     AUTO_BACK_TO_WATERLINE,
// };

// enum Auto_back_progress
// {
//     AUTO_BACK_IDLE,
//     AUTO_BACK_IN_PROGRESS,
//     AUTO_BACK_REACH_WATERLINE,
//     AUTO_BACK_FINISH,
// };

// enum OTA_flag_type
// {
//     OTA_FLAG_TYPE_BOOTLOADER,
//     OTA_FLAG_TYPE_MAIN_PROGRAM,
// };

// // enum Interface_dataframe_type
// // {
// //     INTERFACE_DATAFRAME_TYPE_IOT,
// //     INTERFACE_DATAFRAME_TYPE_DEBUG,
// // };

// enum FLOOR_S_ROUTE_STAGE
// {
//     FLOOR_S_ROUTE_MOVE_FORWARD,
//     FLOOR_S_ROUTE_MOVE_BACKWARD,
//     FLOOR_S_ROUTE_TURN_LEFT,
//     FLOOR_S_ROUTE_TURN_RIGHT,
// };

// #pragma pack(push)
// #pragma pack(1)

// struct Robot_firmware
// {
//     char version[10];
//     char date[14];
//     char time[12];
// };

// struct Robot_info
// {
//     char model[12];
//     char chip;
//     char board_model;
// };

// struct Robot_calibration_parameter
// {
//     short ax_offset;                        //  加速度 X轴 偏移量
//     short ay_offset;                        //  加速度 Y轴 偏移量
//     short az_offset;                        //  加速度 Z轴 偏移量
//     short gx_offset;                        //  角速度 X轴 偏移量
//     short gy_offset;                        //  角速度 Y轴 偏移量
//     short gz_offset;                        //  角速度 Z轴 偏移量
//     float k_power_voltage;                  //  供电电压 校准参数 k
//     float b_power_voltage;                  //  供电电压 校准参数 b
//     float k_pump_current;                   //  水泵电机 电流 校准参数 k
//     float b_pump_current;                   //  水泵电机 电流 校准参数 b
//     float k_motor1_current;                 //  行走电机1 电流 校准参数 k
//     float b_motor1_current;                 //  行走电机1 电流 校准参数 b
//     float k_motor2_current;                 //  行走电机2 电流 校准参数 k
//     float b_motor2_current;                 //  行走电机2 电流 校准参数 b
//     unsigned char imu_calibrated_flag;                  //  IMU传感器校准标志
//     unsigned char power_voltage_calibrated_flag;        //  电源电压校准标志
//     unsigned char pump_current_calibrated_flag;         //  水泵电流校准标志
//     unsigned char motor1_current_calibrated_flag;   //  左行走电流校准标志
//     unsigned char motor2_current_calibrated_flag;  //  右行走电流校准标志
//     unsigned char calibration_finished_flag;            //  标定完成标志
//     unsigned short depth_reference_value;
//     unsigned char depth_reference_calibrated_flag;       //  深度传感器校准标志
// };

// struct Robot_pose_parameter
// {
//     unsigned short max_angle_for_on_floor_state;     //  池底姿态 最大角度
//     unsigned short max_angle_for_tilt_state;         //  抬头姿态 最大角度
//     unsigned short max_angle_for_on_wall_state;      //  爬墙姿态 最大角度
//     short target_angle_for_washing_on_wall;
// };

// struct Robot_alarm_parameter
// {
//     unsigned short walk_motor_current_for_short_circuit;            //  行走电机 短路电流
//     unsigned short pump_motor_current_for_out_water;                //  水泵电机 出水电流
//     unsigned short pump_motor_current_for_overload;                 //  水泵电机 过载电流
//     unsigned short pump_motor_current_for_short_circuit;            //  水泵电机 短路电流

//     short walk_motor_differential_current_for_touching_wall;        //  行走电机 触壁电流 与基准的差值
//     short walk_motor_differential_current_for_overload;             //  行走电机 过载电流 与基准电流的差值
//     short pump_motor_differential_current_for_suck_air;        //  水泵电机 进气电流 与基准电流的差值
//     short walk_motor_accumulated_current_for_touching_wall;           //  行走电机 触壁电流 累加值
//     short walk_motor_accumulated_current_for_overload;                //  行走电机 过载电流 累加值
//     short pump_motor_accumulated_current_for_suck_air;                //  行走电机 进气电流 累加值
// };

// struct Robot_event_configuration
// {
//     unsigned short differential_pwm_for_touching_wall;
//     unsigned short differential_pwm_for_reaching_water_line;

//     unsigned short timeout_for_detecting_touch_wall_on_floor;
//     unsigned short time_for_detecting_touch_wall_by_pwm;
//     unsigned short delay_time_for_detecting_touch_wall;

//     unsigned short gz_variance_gain_for_touching_wall;
//     unsigned short depth_variance_for_stable;
//     unsigned char infrared_distance_for_touching_wall;
//     unsigned char infrared_distance_for_reaching_waterline;
// };

// struct Robot_motor_configuration
// {
//     unsigned short max_pwm;               //  电机最大PMW值
//     unsigned short min_pwm;               //  电机运动的最小PWM值
//     unsigned short max_differential_pwm_on_floor;    //  池底状态下，左右行走电机最大差速PWM值
//     unsigned short max_differential_pwm_on_wall;     //  池壁状态下，左右行走电机最大差速PWM值
//     unsigned short max_pwm_change_time;   //  PWM 增加到最大PMW的最短时间，电机保护 ms
//     unsigned short walk_motor_pwm_baseline_floor;
//     unsigned short walk_motor_pwm_baseline_up_wall;
//     unsigned short walk_motor_pwm_baseline_down_wall;
//     unsigned short walk_motor_pwm_baseline_waterline;
//     unsigned short pump_motor_pwm_baseline_floor;
//     unsigned short pump_motor_pwm_baseline_up_wall;
//     unsigned short pump_motor_pwm_baseline_down_wall;
//     unsigned short pump_motor_pwm_baseline_waterline;
// };


// struct Robot_function_configuration
// {
//     unsigned short accel_time;            //  行走电机 加速时间，运动控制 ms
//     unsigned short cmd_last_time;               //  命令持久时间 超过该时间会自动停止运动 ms
//     unsigned long max_washing_wall_time;        //  最长清洗池壁时间 ms
//     bool imu_sensor_enable;
//     bool depth_sensor_enable;
//     bool infrared_sensor_enable;
//     bool suck_air_action_enable;
//     bool pump_spout_action_enable;
//     bool pump_overload_action_enable;
//     bool walking_overload_action_enable;
//     bool stuck_on_floor_action_enable;
//     bool down_wall_stuck_action_enable;
//     bool variance_touch_wall_detection_function_enable;
//     bool power_balance_function_enable;
//     bool tilt_stuck_action_enable;
// };

// struct Robot_filter_parameter
// {
//     unsigned short filter_coefficient_adc;
//     unsigned short filter_coefficient_current_baseline;
// };

// struct Robot_PID_parameter
// {
//     float T;
//     float k_p;
//     float T_i;
//     float T_d;
//     float k_o;
//     unsigned char do_pid_interval;
// };

// struct Robot_basic_parameter
// {
//     struct Robot_pose_parameter pose_parameter;
//     struct Robot_alarm_parameter alarm_parameter;
//     struct Robot_event_configuration event_configuration;
//     struct Robot_motor_configuration motor_configuration;
//     struct Robot_function_configuration function_configuration;
//     struct Robot_filter_parameter filter_parameter;
//     struct Robot_PID_parameter floor_PID_parameter;
//     struct Robot_PID_parameter wall_PID_parameter;
// };

// //上位机指令参数
// struct Robot_control_cmd
// {
//     enum Robot_operation_mode operation_mode;
//     enum Robot_cleaning_mode cleaning_mode;
//     enum Robot_route_mode route_mode;
//     enum Robot_floor_route_mode floor_route_mode;
//     enum Robot_wall_route_mode wall_route_mode;
//     enum Robot_action action;
// };

// struct Robot_manual_control
// {
//     unsigned short pump_motor_pwm;
//     short control_pwm;
//     short w_z;
//     bool lock_cmd;
// };

// struct Robot_app_manual_control
// {
//     unsigned char rotation_speed;
//     unsigned char movement_speed;
// };

// struct Robot_auto_back_state
// {
//     enum Auto_back_type auto_back_type;
//     enum Auto_back_progress auto_back_progress;
// };

// struct Robot_area_washing_state
// {
//     enum Area_washing_coverage area_washing_coverage;
//     enum Area_washing_progress area_washing_progress;
// };

// struct Sensor_calibration_state
// {
//     enum Sensor_calibration_type sensor_calibration_type;
//     enum Sensor_calibration_progress sensor_calibration_progress;
// };

// struct Robot_quaternion_data
// {
//     short qw;
//     short qx;
//     short qy;
//     short qz;
// };

// struct Robot_imu_data
// {
//     short ax;
//     short ay;
//     short az;
//     short gx;
//     short gy;
//     short gz;
//     // short mx;
//     // short my;
//     // short mz;
// };

// struct Robot_imu_variance
// {
//     float accel[3];
//     float gyro[3];
//     float accel_var_gain[3];
//     float gyro_var_gain[3];
// };

// struct Robot_pose_data
// {
//     float yaw;
//     float pitch;
//     float roll;
//     float theta;
//     float theta_variance;
//     float beta;
//     enum Robot_pose_state pose_state;
//     enum Robot_pose_state last_pose_state;
// };
// struct Robot_power_data
// {
//     unsigned short power_voltage;       //  电源（电池）电压 mV
//     unsigned short left_motor_current;  //  左行走电机 电流 mA
//     unsigned short right_motor_current; //  右行走电机 电流 mA
//     unsigned short pump_motor_current;  //  水泵电机 电流 mA
//     // unsigned short power_switch_adc;    //  电源开关ADC采样值

//     // unsigned short left_motor_current_baseline;
//     // unsigned short right_motor_current_baseline;
//     unsigned short pump_motor_current_baseline[2];
//     unsigned short suck_air_current_baseline;

//     // short left_motor_current_diff;
//     // short right_motor_current_diff;
//     short pump_motor_current_diff[2];
//     short suck_air_current_diff;

//     enum Robot_motor_state left_motor_state;
//     enum Robot_motor_state right_motor_state;
//     enum Robot_motor_state pump_motor_state;
//     unsigned char battery_level;
// };

// struct Robot_power_simulation
// {
//     bool simulation_enable;
//     unsigned short power_voltage;
//     unsigned short left_motor_current;
//     unsigned short right_motor_current;
//     unsigned short pump_motor_current;
// };

// struct Robot_depth_data
// {
//     unsigned short depth;
//     unsigned short max_depth;
//     unsigned short min_depth;
//     float climb_speed;
//     unsigned short depth_baseline;
//     unsigned long depth_variance;
//     unsigned short pool_wall_bottom_depth_baseline;
// };

// struct Robot_depth_receive_data
// {
//     short depth;
//     short temperature;
// };

// struct Robot_infrared_data
// {
//     short distance;
//     unsigned short confidence;
// };

// struct Robot_infrared_calibration_result
// {
//     unsigned char infrared_calibration_type;
//     short calibration_result;
// };

// struct Robot_infrared_receive_data
// {
//     short distance;
//     unsigned short confidence;
// };

// struct Robot_temperature_data
// {
//     short temperature;
//     short temperature_bias;
// };

// struct Robot_pid_data
// {
//     float setpoint;
//     float feedback;
//     float output;
//     bool clear_pid_flag;
// };

// struct Robot_floor_action_item
// {
//     Robot_action action;
//     float yaw_relative_to_baseline;
//     unsigned short pwm;
//     unsigned long time;
//     Robot_direction dir;
// };
// struct Robot_floor_action_group
// {
//     struct Robot_floor_action_item action_item[FLOOR_ACTION_SIZE];
//     unsigned char action_index;
//     unsigned char last_action_index;
//     bool do_action_flag;
// };

// struct Robot_wall_action_item
// {
//     Robot_action action;
//     float beta_relative_to_baseline;
//     unsigned short pwm;
//     unsigned long time;
//     Robot_wall_direction dir;
// };

// struct Robot_wall_action_group
// {
//     struct Robot_wall_action_item action_item[WALL_ACTION_SIZE];
//     unsigned char action_index;
//     unsigned char last_action_index;
//     bool do_action_flag;
// };

// struct Robot_mode
// {
//     enum Robot_operation_mode robot_operation_mode;                 //  运行模式
//     enum Robot_cleaning_mode cleaning_mode;                         //  清洗模式
//     enum Robot_route_mode route_mode;                               //  路径模式
//     enum Robot_route_mode default_floor_route_mode;
//     enum Robot_route_mode default_wall_route_mode;
//     enum Robot_route_mode default_combination_route_mode;
//     enum Robot_route_mode default_all_pool_route_mode;
//     bool pool_shape_adaptive_route_enable;
//     enum Robot_floor_route_mode floor_route_mode;                   //  池底路径模式
//     enum Robot_wall_route_mode wall_route_mode;                     //  池壁路径模式
//     enum Robot_engineering_mode engineering_mode;                   //  工程模式
// };

// struct Robot_state_parameter
// {
//     struct Robot_pose_data pose_data;                               //  姿态数据
//     struct Robot_mode robot_mode;

//     // unsigned long yaw_variance;             //  yaw方差
//     bool touch_wall_detection_enable;       //  触壁监测使能
//     bool pwm_touch_wall_detection_enable;   //  PWM触壁监测使能
//     bool touch_wall_detected;               //  触壁状态指示
//     bool inclination_touch_wall_detected;   //  姿态倾角触壁状态指示
//     bool pwm_touch_wall_detected;           //  PWM触壁状态指示
//     bool touch_wall_timeout;                //  PWM触壁超时指示
//     bool touch_wall_detection_delay_enable; //  触壁延迟使能指示
//     bool variance_touch_wall_detection_enable;
//     bool variance_touch_wall_detected;      //  碰撞触壁检测(根据陀螺仪数据得到)
//     bool infrared_touch_wall_detection_enable;
//     bool infrared_touch_wall_detected;
//     bool infrared_waterline_detected;
//     bool infrared_corner_detected;          //  池壁姿态下探测到泳池转角墙
//     unsigned short touch_wall_count;        //  触壁计数
    
//     bool depth_stable;
//     bool down_wall_stuck;                   //  下墙卡死状态指示
//     bool up_wall_stuck;                     //  上墙卡死状态指示
//     bool stuck_on_floor;                    //  池底卡死状态指示
//     bool stuck_on_floor_detected_by_touch_wall_detector;
//     bool stuck_on_floor_detected_by_turn_direction_timeout_detector;
//     bool tilt_stuck;
//     bool unable_tilt_wash_on_wall;
//     bool reach_top;
//     bool reach_bottom;
//     bool stop_down_wall;
//     bool near_waterline;
//     bool reach_waterline;
//     bool start_up_wall;
//     bool start_down_wall;
//     bool stop_up_wall;
//     bool direction_reversed;                //  池壁清洗后反向运动，到达池底前的反向标记，当有此标记时才开始进行池底路径，避免池底姿态变化导致路径重新开始
//     bool climb_wall;
//     bool need_detect_corner;
//     bool no_head_up_after_touch_wall_detected;
//     bool theta_stable;
//     bool low_power_state;
//     bool suck_air_event;
//     bool need_power_balance;
//     bool edge_detected;                     //  探测到泳池边缘的标记
//     bool out_of_water_action;
//     bool pump_spout_action;
//     bool need_skip_wall_obstacle;

//     unsigned char auto_back_state;

//     unsigned short beta_angle_correct_count;

//     unsigned short total_start_floor_count; //  本次清洗，池底运行的总计数
//     short mode_start_floor_index;           //  当前模式下，池底运行的索引
//     unsigned short total_start_wall_count;  //  本次清洗，池壁运行的总计数
//     short mode_start_wall_index;            //  当前模式下，池壁运行的索引
    
//     // enum Reach_side_wall reach_side_wall;
//     unsigned long down_wall_start_time;                         //  下墙开始时间
//     unsigned long down_wall_period;                             //  下墙持续时间
//     unsigned long down_wall_action_start_time;
//     unsigned long up_wall_start_time;                           //  上墙开始时间
//     unsigned long up_wall_period;                               //  上墙持续时间
//     unsigned long up_wall_action_start_time;                    //  池壁路径开始时间
//     unsigned long on_floor_start_time;                          //  池底运行开始时间
//     unsigned long on_floor_period[ON_FLOOR_PERIOD_LIST_SIZE];   //  单次池底运行持续时间列表
//     unsigned short on_floor_period_index;                       //  单次池底运行持续时间索引
//     unsigned long pool_center_period;       //  泳池半径行走测量时间

//     unsigned long auto_washing_start_time;
//     unsigned long last_running_start_time;
//     unsigned long power_off_start_time;
//     unsigned long total_running_time;      //  总运行时间 秒
//     unsigned long last_washing_start_time;
//     unsigned long total_washing_time;      //  总清洗时间 秒
//     long recent_distance;
// };

// struct Robot_debug_state
// {
//     // unsigned long yaw_variance;             //  yaw方差
//     bool touch_wall_detection_enable;       //  触壁监测使能
//     bool pwm_touch_wall_detection_enable;   //  PWM触壁监测使能
//     bool touch_wall_detected;               //  触壁状态指示
//     bool inclination_touch_wall_detected;   //  姿态倾角触壁状态指示
//     bool pwm_touch_wall_detected;           //  PWM触壁状态指示
//     bool touch_wall_timeout;                //  PWM触壁超时指示
//     bool touch_wall_detection_delay_enable; //  触壁延迟使能指示
//     bool variance_touch_wall_detection_enable;
//     bool variance_touch_wall_detected;
//     unsigned short touch_wall_count;        //  触壁计数
    
//     bool depth_stable;
//     bool down_wall_stuck;                   //  下墙卡死状态指示
//     bool up_wall_stuck;                     //  上墙卡死状态指示
//     bool stuck_on_floor;                    //  池底卡死状态指示
//     bool stuck_on_floor_detected_by_touch_wall_detector;
//     bool stuck_on_floor_detected_by_turn_direction_timeout_detector;
//     bool unable_tilt_wash_on_wall;
//     bool reach_top;
//     bool reach_bottom;
//     bool near_waterline;
//     bool reach_waterline;
//     bool start_up_wall;
//     bool start_down_wall;
//     bool stop_up_wall;
//     bool stop_down_wall;
//     bool direction_reversed;                //  池壁清洗后反向运动，到达池底前的反向标记，当有此标记时才开始进行池底路径，避免池底姿态变化导致路径重新开始
//     bool climb_wall;
//     bool need_detect_corner;
//     bool no_head_up_after_touch_wall_detected;

//     unsigned short total_start_floor_count; //  本次清洗，池底运行的总计数
//     short mode_start_floor_index;           //  当前模式下，池底运行的索引
//     unsigned short total_start_wall_count;  //  本次清洗，池壁运行的总计数
//     short mode_start_wall_index;            //  当前模式下，池壁运行的索引

//     // enum Reach_side_wall reach_side_wall;
//     unsigned long down_wall_period;         //  下墙持续时间
//     unsigned long up_wall_period;           //  上墙持续时间
//     unsigned long on_floor_period;          //  单次池底运行持续时间
//     unsigned long pool_center_period;       //  泳池半径行走测量时间
//     unsigned long total_running_time;      //  总运行时间 秒
// };

// struct Robot_debug_action_parameter
// {
//     enum Robot_action action;
//     enum Robot_direction movement_direction;
//     float yaw_baseline;
//     float yaw_target;
//     float beta_baseline;
//     float beta_target;
//     short depth_target;
//     bool out_of_water_action_enable;
//     bool pump_spout_action_enable;
//     bool suck_air_action_enable;
//     unsigned short turn_direction_stuck_count;
//     unsigned short continuous_stuck_count;
//     unsigned short unable_up_wall_action_timeout_count;
//     unsigned long action_start_time;
// };

// struct Robot_action_parameter
// {
//     enum Robot_action action;
//     enum Robot_direction movement_direction;
//     enum Robot_direction wall_route_upward_dir;
//     short walk_motor_avg_pwm;
//     float yaw_baseline; //  单位 rad * 10000
//     float yaw_target;   //  单位 rad * 10000
//     float beta_baseline; //  单位 rad * 10000
//     float beta_target;   //  单位 rad * 10000
//     short depth_target;
//     float theta_baseline;
//     bool out_of_water_action_enable;
//     bool pump_spout_action_enable;
//     bool suck_air_action_enable;
//     unsigned short turn_direction_stuck_count;
//     unsigned short continuous_stuck_count;
//     unsigned short unable_up_wall_action_timeout_count;
//     struct Robot_floor_action_group floor_action_group;
//     struct Robot_wall_action_group wall_action_group;
//     unsigned long action_start_time;
//     // enum Move_dir_debug move_dir_debug;
//     // enum Action_debug action_debug;
// };

// struct Robot_dynamic_parameter
// {
//     short walk_motor_avg_pwm;
//     short half_diff_pwm;
//     short left_motor_pwm;
//     short right_motor_pwm;
//     short pump_motor_pwm;
//     short left_motor_pwm_actual;
//     short right_motor_pwm_actual;
//     short left_motor_direction_actual;
//     short right_motor_direction_actual;
//     short pump_motor_pwm_actual;
//     float motor_pwm_factor;
//     float pump_pwm_factor;
// };

// struct Pool_parameter
// {
//     union
//     {
//         unsigned short pool_length;
//         unsigned short diameter;
//     };
//     unsigned short pool_width;
//     unsigned short pool_area;
//     unsigned short pool_depth;
//     enum Pool_shape pool_shape;
//     enum Pool_floor_type pool_floor_type;
//     unsigned char pool_floor_max_angle;
//     enum Pool_surface_material pool_surface_material;
// };

// struct Robot_bluetooth_parameter
// {
//     enum Robot_cleaning_mode cleaning_mode;
//     unsigned long remaining_time;
//     unsigned long fault_notification;
//     bool bluetooth_mode;
//     bool bluetooth_mode_allow;
//     bool bluetooth_connected;
//     char bluetooth_mac_address[12];
// };

// struct Robot_config_parameter
// {
//     enum Robot_cleaning_mode cleaning_mode;
//     enum Robot_route_mode default_floor_route_mode;
//     enum Robot_route_mode default_wall_route_mode;
//     enum Robot_route_mode default_combination_route_mode;
//     enum Robot_route_mode default_all_pool_route_mode;
//     bool pool_shape_adaptive_route_enable;
//     Pool_parameter pool_parameter;
// };


// struct Robot_bluetooth_data
// {
//     union
//     {
//         unsigned long pool_length;
//         unsigned long diameter;
//     };
//     unsigned long pool_width;
//     unsigned long pool_area;
//     enum Pool_shape pool_shape;
//     enum Pool_floor_type pool_floor_type;
//     enum Robot_cleaning_mode cleaning_mode;
// };


// struct Robot_communication_pool_paramter
// {
//     struct Pool_type
//     {
//         // unsigned char reserved:3;
//         // unsigned char pool_floor_type:2;
//         // unsigned char pool_shape:3;
//         unsigned char pool_shape:3;
//         unsigned char pool_floor_type:2;
//         unsigned char reserved:3;
//     };
//     struct Pool_type pool_type;
//     unsigned short pool_length;
//     unsigned short pool_width;
//     unsigned short pool_depth;
// };

// // struct Robot_communication_fault_code
// // {
// //     // unsigned char reserved:2;
// //     // unsigned char out_of_water:1;
// //     // unsigned char voltage_fault:1;
// //     // unsigned char right_motor_overload:1;
// //     // unsigned char left_motor_overload:1;
// //     // unsigned char pump_overload:1;
// //     // unsigned char water_leak:1;
// //     // unsigned char reserved_0:8;

// //     unsigned char water_leak:1;
// //     unsigned char pump_overload:1;
// //     unsigned char left_motor_overload:1;
// //     unsigned char right_motor_overload:1;
// //     unsigned char voltage_fault:1;
// //     unsigned char out_of_water:1;
// //     unsigned char reserved_1:2;
// //     unsigned char reserved_2:8;
// // };

// struct Robot_communication_minutes_and_seconds
// {
//     unsigned char minutes;
//     unsigned char seconds;
// };

// struct Product_info
// {
//     unsigned char board_type;
//     unsigned char product_model;
//     unsigned char mcu_model;
//     unsigned char hw_version;
//     unsigned char fw_version[3];
//     unsigned char uid[12];
// };

// struct Device_bitmap
// {
//     unsigned char power_device:1;
//     unsigned char main_control_device:1;
//     unsigned char led_device:1;
//     unsigned char depth_device:1;
//     unsigned char reserved:4;
// };

// struct Device_state
// {
//     struct Device_bitmap owned_devices;
//     struct Device_bitmap online_devices;
//     struct Device_bitmap reboot_devices;
// };

// struct Fault_bitmap
// {
//     unsigned char voltage_fault:1;
//     unsigned char left_motor_overload:1;
//     unsigned char right_motor_overload:1;
//     unsigned char pump_motor_overload:1;
//     unsigned char imu_i2c_fault:1;
//     unsigned char imu_data_fault:1;
//     unsigned char depth_trans_fault:1;
//     unsigned char depth_data_fault:1;

//     unsigned char temperature_trans_fault:1;
//     unsigned char temperature_data_fault:1;
//     unsigned char infrared_trans_fault:1;
//     unsigned char infrared_data_fault:1;
//     unsigned char eeprom_fault:1;
//     unsigned char rtc_fault:1;
//     unsigned char reserved_0:2;

//     unsigned char communication_fault:1;
//     unsigned char power_overload:1;
//     unsigned char reserved_2:6;
// };

// struct Alarm_bitmap
// {
//     unsigned char out_of_water:1;
//     unsigned char pump_spout:1;
//     unsigned char pump_suck_air:1;
//     unsigned char floor_stuck:1;
//     unsigned char down_wall_stuck:1;
//     unsigned char filter_box_full:1;
//     unsigned char reserved_0:2;
// };

// struct Robot_fault_alarm
// {
//     struct Fault_bitmap fault;
//     struct Alarm_bitmap alarm;
// };

// struct Robot_state_bitmap
// {
//     unsigned char touch_wall_detection_enable:1;       //  触壁监测使能
//     unsigned char pwm_touch_wall_detection_enable:1;   //  PWM触壁监测使能
//     unsigned char touch_wall_detected:1;               //  触壁状态指示
//     unsigned char inclination_touch_wall_detected:1;   //  姿态倾角触壁状态指示
//     unsigned char pwm_touch_wall_detected:1;           //  PWM触壁状态指示
//     unsigned char touch_wall_timeout:1;                //  PWM触壁超时指示
//     unsigned char touch_wall_detection_delay_enable:1; //  触壁延迟使能指示
//     unsigned char variance_touch_wall_detection_enable:1;
    
//     unsigned char variance_touch_wall_detected:1;      //  碰撞触壁检测(根据陀螺仪数据得到)
//     unsigned char infrared_touch_wall_detected:1;
//     unsigned char infrared_waterline_detected:1;
//     unsigned char infrared_corner_detected:1;          //  池壁姿态下探测到泳池转角墙
//     unsigned char depth_stable:1;
//     unsigned char down_wall_stuck:1;                   //  下墙卡死状态指示
//     unsigned char up_wall_stuck:1;                     //  上墙卡死状态指示
//     unsigned char stuck_on_floor:1;                    //  池底卡死状态指示
    
//     unsigned char stuck_on_floor_detected_by_touch_wall_detector:1;
//     unsigned char stuck_on_floor_detected_by_turn_direction_timeout_detector:1;
//     unsigned char tilt_stuck:1;
//     unsigned char unable_tilt_wash_on_wall:1;
//     unsigned char reach_top:1;
//     unsigned char reach_bottom:1;
//     unsigned char near_waterline:1;
//     unsigned char reach_waterline:1;

//     unsigned char start_up_wall:1;
//     unsigned char start_down_wall:1;
//     unsigned char stop_up_wall:1;
//     unsigned char stop_down_wall:1;
//     unsigned char direction_reversed:1;                //  池壁清洗后反向运动，到达池底前的反向标记，当有此标记时才开始进行池底路径，避免池底姿态变化导致路径重新开始
//     unsigned char climb_wall:1;
//     unsigned char need_detect_corner:1;
//     unsigned char no_head_up_after_touch_wall_detected:1;
    
//     unsigned char low_power_state:1;
//     unsigned char reserved:7;
// };

// struct IoT_state
// {
//     enum Network_state network_state;
//     enum Bluetooth_state bluetooth_state;
// };

// struct Schedule_config
// {
//     bool schedule_enable;
//     unsigned char interval_hours;
//     unsigned char cycle_time_minutes;
//     // unsigned char schedule_minute;
//     // unsigned char schedule_hour;
//     // unsigned char schedule_weekday;
// };

// struct Schedule_state
// {
//     bool rtc_error;
//     bool rtc_power_down_detected;
//     struct Schedule_config schedule_config;
// };

// struct tm
// {
//   int	tm_sec;
//   int	tm_min;
//   int	tm_hour;
//   int	tm_mday;
//   int	tm_mon;
//   int	tm_year;
//   int	tm_wday;
//   int	tm_yday;
//   int	tm_isdst;
// };

// struct Time_state
// {
//     bool rtc_time_synchronized;
//     bool network_time_validated;
//     struct tm power_on_rtc_time;
//     unsigned int start_washing_system_time;
//     unsigned int stop_washing_system_time;
// };

// struct LED_parameter
// {
//     enum LED_color color;
//     enum LED_mode mode;
// };

// struct Serial_number_data
// {
//     unsigned char device_type;
//     unsigned char serial_number[32];
//     unsigned char length;
// };

// struct Device_name_data
// {
//     unsigned char device_type;
//     char device_name[12];
// };

// struct Serial_number_result
// {
//     unsigned char device_type;
//     unsigned char result;
// };

// enum Production_test_item
// {
//     PRODUCTION_TEST_ITEM_CALIBRATION_DATA,
//     PRODUCTION_TEST_ITEM_MOTOR_INSTALLATION,
//     PRODUCTION_TEST_ITEM_WALKING_MOTOR,
//     PRODUCTION_TEST_ITEM_PUMP_MOTOR,
//     PRODUCTION_TEST_ITEM_IMU_STATIONARY,
//     PRODUCTION_TEST_ITEM_IMU_DRIFT,
//     PRODUCTION_TEST_ITEM_INFRARED_NO_COVER,
//     PRODUCTION_TEST_ITEM_INFRARED_COVER,
//     PRODUCTION_TEST_ITEM_DEPTH_DATA,
//     PRODUCTION_TEST_ITEM_RTC_SCHEDULE,
// };

// enum Production_test_cmd_type
// {
//     PRODUCTION_TEST_CMD_TYPE_START_TEST,
//     PRODUCTION_TEST_CMD_TYPE_GET_STATE,
// };

// struct Production_test_cmd
// {
//     Production_test_item item;
//     Production_test_cmd_type cmd;
// };

// struct Production_test_result
// {
//     Production_test_item item;
//     Engineering_action_state state;
//     unsigned char data[40];
//     unsigned char data_length;
// };

// struct Robot_function_info
// {
//     // 机器类型
//     unsigned char robot_type;
//     // 手动模式
//     unsigned char manual_control:1;     // 低位
//     unsigned char auto_return:1;
//     unsigned char area_washing:1;
//     unsigned char reserve_0:5;          // 高位
//     // 传感器信息
//     unsigned char pose_sensor:1;
//     unsigned char infrared_sensor:1;
//     unsigned char temperature_sensor:1;
//     unsigned char depth_sensor:1;
//     unsigned char reserve_1:4;
//     // 预约模式
//     unsigned char weekly_schedule:1;
//     unsigned char interval_schedule_by_cycle_time:1;
//     unsigned char interval_schedule_by_cycle_count:1;
//     unsigned char smart_cleaning:1;
//     unsigned char delay_cleaning:1;
//     unsigned char cycle_time_config:1;
//     unsigned char reserve_2:2;
//     // 池底模式
//     unsigned char floor_star_route_mode:1;
//     unsigned char floor_S_route_mode:1;
//     unsigned char floor_cross_route_mode:1;
//     unsigned char reserve_3:5;
//     // 池壁模式
//     unsigned char wall_normal_route_mode:1;
//     unsigned char wall_H_route_mode:1;
//     unsigned char wall_N_route_mode:1;
//     unsigned char reserve_4:5;
//     // 组合模式
//     unsigned char twice_wall_twice_floor_mode:1;
//     unsigned char once_wall_once_floor_mode:1;
//     unsigned char reserve_5:6;
//     // 全池模式
//     unsigned char full_pool_star_route_mode:1;
//     unsigned char full_pool_cross_route_mode:1;
//     unsigned char reserve_6:6;
//     // 水线模式
//     unsigned char waterline_route_mode:1;
//     unsigned char reserve_7:7;
//     // 强力池底模式
//     unsigned char powerful_floor_star_route_mode:1;
//     unsigned char powerful_floor_S_route_mode:1;
//     unsigned char powerful_floor_cross_route_mode:1;
//     unsigned char reserve_8:5;
// };

// #pragma pack(pop)

// class Data_holder
// {
// public:
//     static Data_holder *get()
//     {
//         static Data_holder dh;
//         return &dh;
//     }

//     void load_parameter();
//     void save_parameter();
//     void update_touch_wall_debug_state(unsigned int current_time);
//     void update_debug_state(unsigned int current_time);
//     void update_debug_action();

// private:
//     Data_holder();

// public:
//     struct Robot_firmware firmware_info;                            //  固件信息
//     struct Robot_info robot_info;                                   //  机器信息
//     struct Robot_calibration_parameter robot_calibration_parameter; //  标定数据 写入存储
    
//     //  Debug | APP
//     struct Robot_pose_parameter *debug_pose_parameter;              //  【调试 设置】机器姿态参数
//     struct Robot_alarm_parameter *debug_alarm_parameter;            //  【调试 设置】机器报警参数
//     struct Robot_event_configuration *debug_event_configuration;            //  【调试 设置】机器事件参数
//     struct Robot_motor_configuration *debug_motor_configuration;            //  【调试 设置】机器电机参数
//     struct Robot_function_configuration *debug_function_configuration;      //  【调试 设置】机器功能参数
//     struct Robot_filter_parameter *debug_filter_parameter;          //  【调试 设置】机器滤波算法参数
//     struct Robot_PID_parameter *debug_floor_PID_parameter;          //  【调试 设置】机器池底PID参数
//     struct Robot_PID_parameter *debug_wall_PID_parameter;           //  【调试 设置】机器池壁PID参数
//     struct Robot_control_cmd control_cmd;                           //  【调试 设置】控制指令（模式 | 动作）
//     struct Robot_floor_action_group floor_action_group;             //  【调试 设置】池底动作组
//     struct Robot_wall_action_group wall_action_group;               //  【调试 设置】池壁动作组
//     struct Pool_parameter pool_parameter;                           //  【调试 设置】泳池参数

//     struct Robot_mode *debug_mode;                                  //  【调试 显示】机器模式参数
//     struct Robot_debug_state debug_state;                           //  【调试 显示】机器状态参数
//     struct Robot_state_bitmap state_bitmap;
//     struct Robot_debug_action_parameter debug_action_parameter;     //  【调试 显示】机器动作参数
//     struct Robot_manual_control manual_control;                     //  【调试 设置】手动控制
//     struct Robot_app_manual_control app_manual_control;             //  【调试 设置】APP手动控制
//     struct Robot_power_simulation power_simulation;                 //  【调试 设置】上位机设置模拟电流

//     //  内部使用参数
//     struct Robot_basic_parameter basic_parameter;                   //  机器基本参数 共享
//     struct Robot_state_parameter state_parameter;                   //  机器状态参数 共享
//     struct Robot_action_parameter action_parameter;                 //  机器动作参数 共享
//     struct Robot_dynamic_parameter dynamic_parameter;               //  机器动力（动态）参数 共享
//     struct Robot_bluetooth_parameter bluetooth_parameter;           //  蓝牙参数 共享
//     struct Robot_auto_back_state auto_back_state;

//     //  数据
//     unsigned int system_time;                                       //  单片机本次运行系统时间
//     struct Robot_quaternion_data quaternion_data;                   //  四元数 数据 共享
//     struct Robot_imu_data imu_data;                                 //  IMU 数据 共享
//     struct Robot_imu_variance imu_variance;
//     struct Robot_pose_data *pose_data;                               //  姿态 数据 共享
//     struct Robot_power_data power_data;                             //  电压 电流 数据 共享
//     struct Robot_pid_data pid_data;                                 //  PID 数据 共享
//     struct Robot_depth_data depth_data;                             //  深度 数据 共享
//     struct Robot_depth_receive_data depth_receive_data;             //  深度 接收
//     struct Robot_infrared_data infrared_data;                       //  红外  数据 共享
//     struct Robot_infrared_calibration_result infrared_calibration_result;         //  红外  标定数据 结果
//     struct Robot_infrared_receive_data infrared_receive_data;       //  红外 接收
//     struct Robot_bluetooth_data bluetooth_data;
    
//     short water_temperature_data;
//     struct Robot_temperature_data temperature_data;
//     unsigned char imu_calibration_success;
//     unsigned char depth_calibration_success;
//     struct Sensor_calibration_state sensor_calibration_state;

//     // unsigned short theta_histogram[THETA_HISTOGRAM_BIN_SIZE];

//     //  电源数据传输
//     // struct Robot_communication_pool_paramter robot_communication_pool_paramter;         //  泳池参数
//     // struct Robot_communication_fault_code robot_communication_fault_code;               //  机器错误码
//     // short robot_communication_hours;                                                    //  清洗小时数
//     // struct Robot_communication_minutes_and_seconds robot_communication_min_sec;         //  清洗分钟、秒

//     //  IoT数据
//     struct Device_state heartbeat_state;
//     struct Product_info product_info;
//     // struct Fault_bitmap robot_fault[FAULT_RECORDS_SIZE];
//     // struct Alarm_bitmap robot_alarm[FAULT_RECORDS_SIZE];
//     struct Robot_fault_alarm robot_fault_alarm[FAULT_RECORDS_SIZE];
//     struct IoT_state iot_state;
//     bool app_connected;
//     struct Schedule_state schedule_state;
//     struct Time_state time_state;
//     // enum Interface_dataframe_type interface_dataframe_type[3];

//     enum FLOOR_S_ROUTE_STAGE floor_s_route_stage;
//     enum FLOOR_S_ROUTE_STAGE next_floor_s_route_stage;
//     struct LED_parameter led_parameter;

//     struct Serial_number_data serial_number_data;
//     struct Serial_number_result serial_number_result;
//     struct Device_name_data device_name_data;
//     struct Production_test_cmd production_test_cmd;
//     struct Production_test_result production_test_result;
//     bool production_test_button_triggered;
//     /** 调试数据
//      *  [0] IMU校准成功计数
//      *  [1] IMU校准失败计数
//      *  [2] 红外异常数据计数
//      *  [3] 红外正常数据计数
//      *  [4] 红外关闭的次数
//     */ 
//     unsigned short debug_data[DEBUG_RECORDS_SIZE][DEBUG_DATA_SIZE] = {};
//     struct Robot_area_washing_state area_washing_state;
//     struct Robot_function_info function_info;
//     bool watch_dog_reset;
//     unsigned int freq;
// };
#endif
